/**
 * 
 */
package org.jenkon.assertion;

import java.util.Map;

/**
 * class with assertion methods for {@link Map}.
 * 
 * @author jkonopka
 * 
 */
public final class MapAssert {

	/**
	 * hide this public constructor for this util class.
	 */
	private MapAssert() {
	}

	/**
	 * check the {@link Map} with values of is empty. if the {@link Map} is not
	 * empty then <code>throw new {@link IllegalArgumentException}</code> with
	 * the message 'the map is not empty'.
	 * 
	 * @see #isEmpty(Map, String)
	 * @param values
	 *            the {@link Map} with values to check if is empty
	 * @throws IllegalArgumentException
	 *             if the {@link Map} is not empty
	 * @throws NullPointerException
	 *             if the {@link Map} is <code>null</code>
	 */
	public static void isEmpty(final Map<?, ?> values) {
		isEmpty(values, "the map is not empty");
	}

	/**
	 * check the {@link Map} with values of is empty. if the {@link Map} is not
	 * empty then <code>throw new {@link IllegalArgumentException}</code> with
	 * the message.
	 * 
	 * @param values
	 *            the {@link Map} with values to check of is empty
	 * @param message
	 *            the message of the {@link IllegalArgumentException} if the map
	 *            is empty
	 * @throws IllegalArgumentException
	 *             if the {@link Map} is not empty
	 * @throws NullPointerException
	 *             if the {@link Map} is <code>null</code>
	 */
	public static void isEmpty(final Map<?, ?> values, final String message) {
		if (!values.isEmpty()) {
			throw new IllegalArgumentException(message);
		}
	}

}
